﻿using System;
using System.Collections.Generic;

namespace Portables.Collections
{
   public class DelegatedComparer<T> : IComparer<T>
   {
      private readonly Func<T, T, int> _comparer;

      public DelegatedComparer(Func<T, T, int> comparer)
      {
         _comparer = comparer;
      }

      public Func<T, T, int> Comparer
      {
         get { return _comparer; }
      }

      public int Compare(T x, T y)
      {
         return _comparer(x, y);
      }
   }
}